<?php

declare (strict_types=1);
namespace App\Model;

use Hyperf\Database\Model\SoftDeletes;
/**
 * @property int $id 主键
 * @property int $mid 机构id
 * @property int $dept_id 关联部门
 * @property int $car_id 关联车辆
 * @property string $violation_person 违章人
 * @property string $violation_date 车辆违章时间
 * @property string $violation_behavior 车辆违章行为
 * @property string $inspection_station 车辆违章地点
 * @property int $deduction_points 扣除分数
 * @property string $fine_amount 罚款金额
 * @property int $status 状态0未处理1已处理
 * @property string $remark 备注
 * @property int $created_user 创建人
 * @property \Carbon\Carbon $created_at 创建时间
 * @property \Carbon\Carbon $updated_at 更新时间
 * @property string $deleted_at 软删除字段
 */
class VehicleViolationRecord extends BaseModel
{
    use SoftDeletes;
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'vehicle_violation_records';

    protected $hidden = ['deleted_at'];
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['id', 'mid', 'dept_id', 'car_id', 'violation_person', 'violation_date', 'violation_behavior', 'inspection_station', 'deduction_points', 'fine_amount', 'status', 'remark', 'created_user', 'created_at', 'updated_at', 'deleted_at'];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'int', 'mid' => 'integer', 'dept_id' => 'integer', 'car_id' => 'integer', 'deduction_points' => 'integer', 'status' => 'integer', 'created_user' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
    /**
     * [createuser 创建者]
     * @return [type] [description]
     */
    public function createuser()
    {
        return $this->hasOne(User::class, 'id', 'created_user');
    }
    /**
     * [vehicle 关联车辆]
     * @return [type] [description]
     */
    public function vehicle()
    {
        return $this->hasOne(Vehicle::class, 'id', 'car_id');
    }
    /**
     * [org 机构]
     * @return [type] [description]
     */
    public function org()
    {
        return $this->hasOne(Institution::class, 'id', 'mid');
    }
}